//
//  PeopleListView.m
//  Estate
//
//  Created by heyong on 16/6/25.
//  Copyright © 2016年 ttsx. All rights reserved.
//

#import "PeopleListView.h"

@implementation PeopleListView
- (UIButton *)cancelBtn{
    if(_cancelBtn==nil){
        _cancelBtn=[[UIButton alloc]initWithFrame:CGRectMake(0, DEF_SCREEN_HEIGHT-50, DEF_SCREEN_WIDTH*0.85/2-1, 50)];
        _cancelBtn.backgroundColor=[TTTheme defaultManger].selectColor;
        [_cancelBtn setTitle:@"取消" forState:UIControlStateNormal];
    }
    return _cancelBtn;
}

- (UIButton *)sureBtn{
    if(_sureBtn==nil){
        _sureBtn=[[UIButton alloc]initWithFrame:CGRectMake(DEF_SCREEN_WIDTH*0.85/2, DEF_SCREEN_HEIGHT-50,DEF_SCREEN_WIDTH*0.85/2, 50)];
        _sureBtn.backgroundColor=[TTTheme defaultManger].selectColor;
        [_sureBtn setTitle:@"确定" forState:UIControlStateNormal];
    }
    
    return _sureBtn;
}
- (UICollectionView *)collectionView{
    if(_collectionView==0){
        UICollectionViewFlowLayout *flowLayout=[[UICollectionViewFlowLayout alloc]init];
        //组头高
        flowLayout.headerReferenceSize = CGSizeMake(0, 40);
        
        //设置行间距-最小行间距
        flowLayout.minimumLineSpacing=5;
        //设置每单元格左右间距
        flowLayout.minimumInteritemSpacing=5;
        
        //滑动的方向
        flowLayout.scrollDirection=UICollectionViewScrollDirectionVertical;
        //设置view的周边间距
        flowLayout.sectionInset=UIEdgeInsetsMake(5, 5, 5, 5);
        //设置单元格的大小
        flowLayout.itemSize=CGSizeMake((DEF_WIDTH(self)-25)/4, 30);
        //设置滚动方向
        flowLayout.scrollDirection=UICollectionViewScrollDirectionVertical;
        //设置fram
        self.collectionView=[[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, DEF_WIDTH(self), DEF_HEIGHT(self)) collectionViewLayout:flowLayout];
        //设置collection
        self.collectionView.showsVerticalScrollIndicator=NO;
        self.collectionView.backgroundColor=[UIColor whiteColor];
    }
    return _collectionView;
}

- (instancetype)initWithFrame:(CGRect)frame{
    if(self=[super initWithFrame:frame]){
         [self addSubview:self.collectionView];
        [self addSubview:self.cancelBtn];
        [self addSubview:self.sureBtn];
    }
    return self;
}

@end
